import request from '@/http/request'

export async function getEntranceCrowdStatistical(data: any) {
	return await request({
		url: `/business/statistical/getEntranceCrowdStatistical?day=${data}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}
export async function getMyMessage(data: any) {
	return await request({
		url: `/business/Message/getMyMessage?pageNum=${data.pageNum}&pageSize=${data.pageSize}&userId=${data.userId}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}
// http://192.168.88.129:9007/business/device/page?pageNum=1&pageSize=10
// 火车列表信息
export async function getTrainList(data: any) {
	return await request({
		url: `/business/rainwayTrain/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&trainNo=${data.name}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 地铁列表信息
export async function getSubwayList2(data: any) {
	return await request({
		url: `/business/subwayLine/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&name=${data.name}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 地铁列表信息
export async function getSubwayList(data: any) {
	return await request({
		url: `/business/subwayLine/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&name=${data.name}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 消息通知
export async function getNotifyList(data: any) {
	return await request({
		url: `/business/notify/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&name=${data.name}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 公交
export async function getBusList(data: any) {
	return await request({
		url: `/business/busCarStatistical/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}&lineName=${data.name}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 
export async function getPerfFlow(data: any) {
	return await request({
		url: `/business/statistical/passengerFlow/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 报表铁路信息
export async function getTrainInfo(data: any) {
	return await request({
		url: `/business/statistical/railway/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 集散信息 /business/statistical/distributedWay
export async function getDistribut(data: any) {
	return await request({
		url: `/business/statistical/distributedWay/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 设备耗能  
export async function getDeviceTypeEnergy(data: any) {
	return await request({
		url: `/business/statistical/deviceTypeEnergy/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 客流流向

export async function getPassengerFlowCityCount(data: any) {
	return await request({
		url: `/business/statistical/passengerFlowCityCount/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 设备状态
export async function getDeviceStatus(data: any) {
	return await request({
		url: `/business/statistical/deviceStatus/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

export async function getTrafficEventCountStatistical(start: string, end: string) {
	return await request({
		url: `/business/statistical/getTrafficEventCountStatistical?startDay=${start}&endDay=${end}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}


// 设备数量
export async function getAllDeviceCount() {
	return await request({
		url: `/business/device/allDeviceCount`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 消息
// 设备状态
export async function getMessageList(data: any) {
	return await request({
		url: `/business/Message/page?pageNum=${data.pageNum}&pageSize=${data.pageSize}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 地铁客流量统计
export async function getSubwayPassengerStatistical() {
	const date = new Date();
	const year = date.getFullYear();
	const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需+1
	const day = String(date.getDate()).padStart(2, '0');
	const beginTime = `${year}-${month}-${day}`;
	const endTime = `${year}-${month}-${day} 23:59:59`;
	return await request({
		url: `/business/statistical/getSubwayPassengerStatistical?day=${beginTime}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

export async function getRailwayPassengerStatistical() {
	const date = new Date();
	const year = date.getFullYear();
	const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需+1
	const day = String(date.getDate()).padStart(2, '0');
	const beginTime = `${year}-${month}-${day}`;
	return await request({
		url: `/business/statistical/getRailwayPassengerStatistical?day=${beginTime}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

// 客流时段统计
export async function stationPassengerFlowCount() {
	const date = new Date();
	const year = date.getFullYear();
	const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需+1
	const day = String(date.getDate()).padStart(2, '0');
	const beginTime = `${year}-${month}-${day} 00:00:00`;
	const endTime = `${year}-${month}-${day} 23:59:59`;
	return await request({
		url: `/business/statistical/stationPassengerFlowCount/page?pageNum=1&pageSize=100&beginTime=${beginTime}&endTime=${endTime}`,
		headers: {
			isToken: false,
		},
		method: 'get'
	})
}

export async function addMessage(data: any) {
	return await request({
		url: `/business/Message/add`,
		data: data,
		method: "post"
	})
}
